/*
 * TablePanel.hpp
 *
 * Copyright 2012 Pieter Agten
 *
 * This file is part of tltgen.
 *
 * tltgen is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * tltgen is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with tltgen.  If not, see <http://www.gnu.org/licenses/>.
 */

/**
 * @file   TablePanel.hpp
 * @author Pieter Agten (pieter.agten@gmail.com)
 * @date   3 sep 2012
 */

#ifndef TABLEPANEL_HPP
#define TABLEPANEL_HPP

#include <wx/wx.h>
#include <wx/aui/auibook.h>

#include "TemperatureScale.hpp"
#include "ThermistorTable.hpp"
#include "GridPanel.hpp"
#include "ResistanceTemperaturePlot.hpp"
#include "AdcValueTemperaturePlot.hpp"

#include <stdexcept>
#include <boost/shared_ptr.hpp>

using boost::shared_ptr;

namespace tltgen {

  class TablePanel : public wxPanel {
  public:
    TablePanel(wxWindow* parent, wxWindowID id, const shared_ptr<ThermistorTable>& thermistorTable, const shared_ptr<LeastSquaresSolver>& solver, const shared_ptr<TemperatureScale>& temperatureScale, const wxPoint& pos, const wxSize& size);
    virtual ~TablePanel();

    static bool isValidThermistorTable(const shared_ptr<ThermistorTable>& thermistorTable);

    void addPlot(const shared_ptr<Plot>& plot);

    void addThermistorModel(const shared_ptr<ThermistorModel>& thermistorModel);

    bool isValidTemperatureScale(const shared_ptr<TemperatureScale>& temperatureScale) const;
    void setTemperatureScale(const shared_ptr<TemperatureScale>& temperatureScale);
    shared_ptr<ThermistorTable> getThermistorTable() const;

  protected:
    DECLARE_EVENT_TABLE();

    GridPanel *gridPanel;
    wxAuiNotebook* notebook;

    shared_ptr<ThermistorTable> thermistorTable;
    shared_ptr<ResistanceTemperaturePlot> resistanceTemperaturePlot;
    shared_ptr<AdcValueTemperaturePlot> adcValueTemperaturePlot;
  };

  enum {
    ID_ViewNotebook = 1,
    ID_GridPanel,
  };

}

#endif


